//设置性别
function setSex(obj) {
	var param = {
		id:$(obj).attr("dataId"),
		sex:$(obj).val()
	};
	API.elementReasonClassSetSex(param, function(res) {
		if(res.code == 0) {
			
		} else {
			alert(res.desc);
		}
	});
}

//设置年龄
function setAge(obj) {
	var param = {
		id:$(obj).attr("dataId"),
		age:$(obj).val(),
		flag:$(obj).prop("checked")
	};
	API.elementReasonClassSetAge(param, function(res) {
		if(res.code == 0) {
			
		} else {
			alert(res.desc);
		}
	});
}

function submitSexAge(obj) {
	if(UTIL.checkButton(obj)) {
		var ids = '';

		$("select[name='sex']").each(function() {
			ids += $(this).attr("dataId") + ",";
		});
		var param = {
			"ids" : ids
		};
		API.elementReasonClassSubmitSexAge(param, function(res) {
			if(res.code == 0) {
				window.location.reload();
				$(window).scrollTop(0);
			} else {
				alert(res.desc);
			}
			UTIL.releaseButton(obj);
		});
	}
}
